Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second min and so on. Examples:...
Given an array A[] of size N. Solve Q queries. Find the product in the range [L, R] under modulo P ( P is Prime)....
Given a sorted array of positive integers, rearrange the array alternately i.e first element should be the maximum value, second minimum value, third-second max, fourth-second min and so on. Examples:...
Given two numbers represented by linked lists, write a function that returns the multiplication of these two linked lists....
Given three integer N, K and X, the task is to create an array of length N such that sum of all its K-length subarrays modulo N is X.Examples:...
Given positive integers k, a and b we need to print last k digits of a^b ie.. pow(a, b)....
Padovan Sequence similar to Fibonacci sequence with similar recursive structure. The recursive formula is,...
Given x, k and m. Compute (xxxx…k)%m, x is in power k times. Given x is always prime and m is greater than x....
Given two integers N and M, the task is to find the sequence of the minimum number of operations required to convert the number N into M such that in each operation N can be added (N = N + N), subtracted as (N = N – N), multiplied as (N = N*N), or divided as (N = N/N). If it is not possible to convert N into M then print “-1”....
You are given a function f(n) = (n1 + n2 + n3 + n4), you have to find the value of f(n) mod 5 for any given value of positive integer n. Note: n may be large enough, such that f(n) > 1018. Examples :...
Given the first term (A) and common difference (D) of an Arithmetic Progression, and a prime number (P). The task is to find the position of the first element in the given AP which is a multiple of the given prime number P.Examples:...